package io.renren.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.commons.mybatis.service.impl.CrudServiceImpl;
import io.renren.dao.VisitorAppointmentDao;
import io.renren.dto.VisitorAppointmentDTO;
import io.renren.entity.VisitorAppointmentEntity;
import io.renren.service.VisitorAppointmentService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 访客
 *
 * @author liuyujun 384880231@qq.com
 * @since 3.0 2022-01-13
 */
@Service
public class VisitorAppointmentServiceImpl extends CrudServiceImpl<VisitorAppointmentDao, VisitorAppointmentEntity, VisitorAppointmentDTO> implements VisitorAppointmentService {

    @Override
    public QueryWrapper<VisitorAppointmentEntity> getWrapper(Map<String, Object> params){
        QueryWrapper<VisitorAppointmentEntity> wrapper = new QueryWrapper<>();

        String visitorName = (String)params.get("visitorName");
        wrapper.like(StringUtils.isNotBlank(visitorName), "visitor_name", visitorName);
        String visitorPlate = (String)params.get("visitorPlate");
        wrapper.like(StringUtils.isNotBlank(visitorPlate), "visitor_plate", visitorPlate);
        String creator = (String)params.get("creator");
        wrapper.like(StringUtils.isNotBlank(creator), "creator", creator);

        return wrapper;
    }


}